@extends('layout.default')

@section('stylesheet')
  <link href="//cdn.bootcss.com/bootstrap-daterangepicker/2.1.27/daterangepicker.min.css" rel="stylesheet">
@stop

@section('layout.content')

  <div class="row">
    <div class="col-xs-12">
      <form method="get" action="{{route('volunteer.statistics')}}" class="form-horizontal">
        <input type="hidden" name="date_begin" value=""/>
        <input type="hidden" name="date_end" value=""/>
        <input type="hidden" name="type" value="2"/>
        <div class="space-12"></div>
        <div class="col-xs-12">
          <div class="form-group">
            <div class="col-xs-12 col-sm-6">
              <div class="input-group">
            <span class="input-group-addon">
              <i class="fa fa-calendar bigger-110"></i>
            </span>
                <input class="form-control" type="text" name="daterangepicker" id="daterangepicker"
                       style="padding:0 10px;height:45px;font-size:18px;font-weight: bold;"/>

                <span class="input-group-btn">
              <button class="btn btn-primary hidden-480" id="btn-sign" type="submit"
                      style="height:45px;font-size:14px;">
                <i class="ace-icon fa fa-search"></i>
                统计查询
              </button>

            </span>
              </div>
            </div>
          </div>
        </div>
      </form>
    </div>
  </div><!-- /.row -->


  <div class="row">
    <div class="col-xs-12">
      @if (isset($rows))
        <h4 class="header smaller lighter orange">统计结果</h4>
        <table id="search_list" class="table table-hover table-striped table-bordered nonborder">
          <thead>
          <tr>
            <th class="center">帐号</th>
            <th>姓名</th>
            <th class="center">签到</th>
            <th class="center">手机号码</th>
            <th class="hidden-480 center">身份证</th>
            <th class="hidden-480 center">登记时间</th>
            <th class="hidden-480 center">分组</th>
            <th class="hidden-480 center">打印</th>
          </tr>
          </thead>

          <tbody>
          @foreach ($rows as $key=>$row)
            <tr>
              <td class="center"><a href="{{route('bank.user.edit',array('user'=>$row->user->id))}}" class="uid"
                                    data-id="{{ $row->user->id }}">{{ $row->user->account }}</a></td>
              <td class="align-middle">{!! $row->user->present()->face !!} <a
                    href="{{route('bank.user.show',array('uid'=>$row->user->id))}}" class="uid"
                    data-id="{{ $row->user->id }}">{{ $row->user->name }}</a></td>
              <td class="center b-sign"><b>{{ $row->total }}</b></td>
              <td class="center">{{ $row->user->mobile }}</td>
              <td class="hidden-480 center">{{ $row->user->idcard }}</td>
              <td class="hidden-480 center">{{ date('Y-m-d',$row->user->created_at) }}</td>
              <td class="hidden-480 align-middle">{{ $row->user->school->name }}</td>
              <td class="hidden-480 center"><a href="{{route('bank.user.print',array('uid'=>$row->user->id))}}"><i
                      class="ace-icon fa fa-print grey bigger-120"></i></a></td>
            </tr>
          @endforeach
          </tbody>
        </table>
      @endif
    </div>
  </div>

@stop

@section('javascript')

  <script src="//cdn.bootcss.com/moment.js/2.24.0/moment.min.js"></script>
  <script src="//cdn.bootcss.com/moment.js/2.24.0/locale/zh-cn.js"></script>
  <script src="//cdn.bootcss.com/bootstrap-daterangepicker/2.1.27/daterangepicker.min.js"></script>
  <script type="text/javascript">
      $(function () {
          $('#account').focus();

          $('#daterangepicker').daterangepicker({
              ranges: {
                  '上周': [moment().subtract(6, 'days'), moment()],
                  '上月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
                  '本月': [moment().startOf('month'), moment().endOf('month')],
                  '上年度': [moment().subtract(1, 'year').startOf('year'), moment().subtract(1, 'year').endOf('year')],
                  '本年度': [moment().startOf('year'), moment().endOf('year')]
              },
              showWeekNumbers: true,
              locale: {
                  applyLabel: '确定', //确定按钮文本
                  cancelLabel: '取消', //取消按钮文本
                  customRangeLabel: '自定义',
                  firstDay: 1
              },
          }, function (start, end, label) {
              $('input[name="date_begin"]').attr('value', start.format('YYYY-MM-DD'));
              $('input[name="date_end"]').attr('value', end.format('YYYY-MM-DD'));
              //timeRangeChange = [start.format('YYYY-MM-DD'), end.format('YYYY-MM-DD')];
              //console.log(timeRangeChange);
          });

      });
  </script>
@stop
